package me.helllp.book.netty.step00;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class TimeServerHandlerExecutorPool {
	private ExecutorService executro;
	
	public TimeServerHandlerExecutorPool(int maxPoolSize, int queueSize){
		executro = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), 
				maxPoolSize, 120L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(queueSize));
	}
	
	public void executor(Runnable task){
		executro.execute(task);
	}
}
